package com.tianqi.familymap.ui.impl

import com.tianqi.familymap.model.PageBean
import com.tianqi.familymap.model.RecommendMultipleModel
import com.tianqi.familymap.model.TQBean
import com.tianqi.familymap.ui.view.IRecommentView
import io.reactivex.Observer
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable

class TRecomment(private val compositeDisposable: CompositeDisposable,private val mIRecommentView:IRecommentView?,private var bean: TQBean<PageBean<RecommendMultipleModel>>?) :
    Observer<TQBean<PageBean<RecommendMultipleModel>>?> {
    override fun onSubscribe(d: Disposable) {
        compositeDisposable.add(d);
    }

    override fun onNext(t: TQBean<PageBean<RecommendMultipleModel>>) {
        bean = t
    }

    override fun onError(e: Throwable) {
        mIRecommentView?.showErrorMsg("请求失败:\n$e")
    }

    override fun onComplete() {
        mIRecommentView?.showAndroidData(bean!!)
    }
}